/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package matrix;

import cern.colt.matrix.DoubleFactory2D;
import cern.colt.matrix.DoubleMatrix2D;
import cern.colt.matrix.impl.DenseDoubleMatrix2D;
import cern.colt.matrix.linalg.EigenvalueDecomposition;

/**
 *
 * @author Niki
 */
public class Main {
    private static boolean wantDense;
    private static boolean wantSparseHashed;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        DoubleFactory2D factory;
        if (wantDense) factory = DoubleFactory2D.dense;
        else if (wantSparseHashed) factory = DoubleFactory2D.sparse;
        else factory = DoubleFactory2D.rowCompressed;

        // From now on all instantiations will go via the factory -
        // No explicit constructor calls anymore
        DoubleMatrix2D matrix = factory.make(3,3);
        matrix.viewColumn(0).assign(new double[]{1,3,1/5});
        matrix.viewColumn(1).assign(new double[]{1/3,1,1/7});
        matrix.viewColumn(2).assign(new double[]{5,7,1});
        System.out.println(matrix);

        EigenvalueDecomposition v = new EigenvalueDecomposition(matrix);
        System.out.println(v.getRealEigenvalues());
    }

}
